import { request } from "@/utils/service"
import type * as DeliveryApply from "./types/delivery-apply"
import type * as Delivery from "./types/delivery"

/** 获取配送员申请列表 */
export function getDeliveryApplyDataApi(params: DeliveryApply.GetDeliveryApplyRequestData) {
  return request<DeliveryApply.DeliveryApplyResponseData>({
    url: "/delivery/apply/list",
    method: "get",
    params
  })
}

/** 审核配送员申请 */
export function auditDeliveryApplyApi(data: DeliveryApply.AuditDeliveryApplyRequestData) {
  return request({
    url: "/delivery/apply/audit",
    method: "post",
    data
  })
}

/** 获取配送员信息列表 */
export function getDeliveryDataApi(params: Delivery.GetDeliveryRequestData) {
  return request<Delivery.DeliveryResponseData>({
    url: "/delivery/list",
    method: "get",
    params
  })
}

/** 更新配送员信息 */
export function updateDeliveryApi(data: Delivery.UpdateDeliveryRequestData) {
  return request({
    url: "/delivery/update",
    method: "put",
    data
  })
}

/** 获取配送员详情 */
export function getDeliveryDetailApi(id: number) {
  return request<Delivery.DeliveryData>({
    url: `/delivery/detail/${id}`,
    method: "get"
  })
}